package com.kk.permission.handler;

import com.kk.permission.handler.interfaces.IConfigHandler;
import com.kk.permission.utils.Permission;

import java.util.ArrayList;
import java.util.List;

public final class ConfigHandler implements IConfigHandler {
    public static final String TAG = "ConfigHandler";
    private static volatile IConfigHandler sInstance;
    private boolean isReset = false;
    private boolean isVivoAuto = false;
    private boolean isXiaomiChannel = false;
    private int mAppIconResId;
    private String mAppName;
    private String mAutoDialogName;
    private String mHalfPermissionTitle;
    private List<Permission> mHidePermissionList = new ArrayList();
    private String mInstallShortCutDisplayName;
    private String mLockDisplayName;
    private String mMainApplicationPkgName;
    private String mNotiDialogName;
    private String mPermissionGuildHint;
    private List<Permission> mPermissionList = new ArrayList();
    private String mQuitContent;
    private String mQuitTitle;
    private String mRingDialogName;
    private String mServiceLabel;
    private String mSuccessHint;
    private String mToastDialogName;
    private String mToastDisplayName;

    private ConfigHandler() {
    }

    public static IConfigHandler getInstance() {
        if (sInstance == null) {
            synchronized (ConfigHandler.class) {
                if (sInstance == null) {
                    sInstance = new ConfigHandler();
                }
            }
        }
        return sInstance;
    }

    public String getAppName() {
        return this.mAppName;
    }

    public IConfigHandler setAppName(String str) {
        this.mAppName = str;
        return this;
    }

    public int getIconResId() {
        return this.mAppIconResId;
    }

    public IConfigHandler setIconResId(int i) {
        this.mAppIconResId = i;
        return this;
    }

    public IConfigHandler setToastDisplayName(String str) {
        this.mToastDisplayName = str;
        return this;
    }

    public String getToastDisplayName() {
        return this.mToastDisplayName;
    }

    public IConfigHandler setToastDialogName(String str) {
        this.mToastDialogName = str;
        return this;
    }

    public String getToastDialogName() {
        return this.mToastDialogName;
    }

    public IConfigHandler setLockDisplayName(String str) {
        this.mLockDisplayName = str;
        return this;
    }

    public String getLockDisplayName() {
        return this.mLockDisplayName;
    }

    public IConfigHandler setInstallShortCutDisplayName(String str) {
        this.mInstallShortCutDisplayName = str;
        return this;
    }

    public String getInstallShortCutDisplayName() {
        return this.mInstallShortCutDisplayName;
    }

    public String getServiceLabel() {
        return this.mServiceLabel;
    }

    public IConfigHandler setServiceLabel(String str) {
        this.mServiceLabel = str;
        return this;
    }

    public String getMainAppPkgName() {
        return this.mMainApplicationPkgName;
    }

    public IConfigHandler setMainAppPkgName(String str) {
        this.mMainApplicationPkgName = str;
        return this;
    }

    public IConfigHandler setPermissionSuccessHint(String str) {
        this.mSuccessHint = str;
        return this;
    }

    public String getPermissionSuccessHint() {
        return this.mSuccessHint;
    }

    @Deprecated
    public IConfigHandler setPermissionGuildHint(String str) {
        this.mPermissionGuildHint = str;
        return this;
    }

    public IConfigHandler setQuitDialogContent(String str) {
        this.mQuitContent = str;
        return this;
    }

    public IConfigHandler setQuitDialogTitle(String str) {
        this.mQuitTitle = str;
        return this;
    }

    public String getQuitDialogTitle() {
        return this.mQuitTitle;
    }

    public String getQuitDialogContent() {
        return this.mQuitContent;
    }

    public String getPermissionGuildHint() {
        return this.mPermissionGuildHint;
    }

    public List<Permission> getPermissionList() {
        return this.mPermissionList;
    }

    public IConfigHandler setPermissionList(Permission... permissionArr) {
        for (Permission permission : permissionArr) {
            if (!this.mPermissionList.contains(permission)) {
                if (permission.equals(Permission.TOAST)) {
                    this.mPermissionList.add(0, permission);
                } else {
                    this.mPermissionList.add(permission);
                }
            }
        }
        if (this.mPermissionList.contains(Permission.TRUST_APP)) {
            this.mPermissionList.remove(Permission.TRUST_APP);
            this.mPermissionList.add(Permission.TRUST_APP);
        }
        return this;
    }

    public List<Permission> getHidePermissionList() {
        return this.mHidePermissionList;
    }

    public IConfigHandler setHidePermissionList(Permission... permissionArr) {
        for (Permission obj : permissionArr) {
            if (!this.mHidePermissionList.contains(obj)) {
                this.mHidePermissionList.add(obj);
            }
        }
        return this;
    }

    public IConfigHandler setXiaomiChannel(boolean z) {
        this.isXiaomiChannel = z;
        return this;
    }

    public boolean getXiaomiChannel() {
        return this.isXiaomiChannel;
    }

    public IConfigHandler setHalfPermissionTitle(String str) {
        this.mHalfPermissionTitle = str;
        return this;
    }

    public String getHalfPermissionTitle() {
        return this.mHalfPermissionTitle;
    }

    public IConfigHandler setAutobootDialogTitle(String str) {
        this.mAutoDialogName = str;
        return this;
    }

    public String getAutobootDialogTitle() {
        return this.mAutoDialogName;
    }

    public IConfigHandler setRingtonDialogTitle(String str) {
        this.mRingDialogName = str;
        return this;
    }

    public String getRingtonDialogTitle() {
        return this.mRingDialogName;
    }

    public IConfigHandler setNotiDialogTitle(String str) {
        this.mNotiDialogName = str;
        return this;
    }

    public String getNotiDialogTitle() {
        return this.mNotiDialogName;
    }

    public boolean getIsReset() {
        return this.isReset;
    }

    public IConfigHandler setIsReset(boolean z) {
        this.isReset = z;
        return this;
    }

    public IConfigHandler setIsVivoAuto(boolean z) {
        this.isVivoAuto = z;
        return this;
    }

    public boolean getIsVivoAuto() {
        return this.isVivoAuto;
    }
}
